<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class GenLic extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'dorm:gen_lic {allow_users}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '生成许可文件';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $obj=['allow_user'=>$this->argument('allow_users')];
        $b64_data=base64_encode(serialize($obj));
        $licFile = public_path('uploads/lic/license.dat');
        file_put_contents($licFile,$b64_data);
    }
}
